Skip to content

gh-101178: Fix UB in binascii.b2a_ascii85#148166

Merged
StanFromIreland merged 1 commit intopython:mainfrom
StanFromIreland:binascii.b2a_ascii85
Apr 7, 2026
Merged

gh-101178: Fix UB in binascii.b2a_ascii85#148166
StanFromIreland merged 1 commit intopython:mainfrom
StanFromIreland:binascii.b2a_ascii85

Conversation

@StanFromIreland
Copy link
Copy Markdown
Member

@StanFromIreland StanFromIreland commented Apr 6, 2026

Spotted when running the test:

$ ./python -m test test_binascii
Using random seed: 2254522381
0:00:00 load avg: 0.43 Run 1 test sequentially in a single process
0:00:00 load avg: 0.43 [1/1] test_binascii
Modules/binascii.c:1243:42: runtime error: left shift of 129 by 24 places cannot be represented in type 'int'
Modules/binascii.c:1484:42: runtime error: left shift of 130 by 24 places cannot be represented in type 'int'
0:00:00 load avg: 0.43 [1/1] test_binascii passed

== Tests result: SUCCESS ==

1 test OK.

Total duration: 89 ms
Total tests: run=197 skipped=17
Total test files: run=1/1
Result: SUCCESS

Copy link
Copy Markdown
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. LGTM. 👍

@StanFromIreland StanFromIreland merged commit 63d3c49 into python:main Apr 7, 2026
59 checks passed
@StanFromIreland StanFromIreland deleted the binascii.b2a_ascii85 branch April 7, 2026 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants